<template name="authenticationdata">
  <view class="authenticationdata">
    <view class="navigation">
      <image class="navigationIcon" src="../../static/arrow.png" mode="" @click="navigateBack"></image>
      <text class="navigationText">Personal information</text>
    </view>
    <view class="main">
      <view class="box">
        <view class="filed" v-for="(itm, idx) in labelOption" :key="idx">
          <view class="label">
            <view class="sub" v-if="itm.sub">{{ itm.sub }}</view>
            {{ itm.label }}
          </view>
          <view class="value">{{ itm.value }}</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { getDecryptString } from '../../defaut';
export default {
  name: 'authenticationdata',
  data() {

    return {
      labelOption: [
        {
          label: 'Birthday',
          value: '',
          key: 'brithday'
        },
        {
          label: 'Gender',
          value: '',
          key: 'gender'
        },
        {
          label: 'Married',
          value: '',
          key: 'married'
        },
        {
          label: 'FullName',
          value: '',
          key: 'fullName'
        },
        {
          label: 'Email',
          value: '',
          key: 'email'
        },
        {
          label: 'Employment Type',
          value: '',
          key: 'employmentType'
        },
        {
          label: 'Uncome Monthly',
          value: '',
          key: 'unconmeMonthly'
        },
        {
          label: 'working since',
          value: '',
          key: 'workingSince'
        },
        {
          label: 'IFSC code',
          value: '',
          key: 'ifscCode'
        },
        {
          label: 'Branch Name',
          value: '',
          key: 'branchName'
        },
        {
          label: 'Branch Account No',
          value: '',
          key: 'bankAccountNo'
        },
        {
          label: 'Aadhaar number',
          value: '',
          key: 'cardNumber'
        },
      ],
    };
  },
  methods: {
    // 返回
    navigateBack() {
      uni.navigateBack({
        delta: 1
      })
    },
    // 获取数据
    async getData() {
      const res = await this.$http.get("/user/v1/getcurruser", {})
      if (res.data.status == 200) {
        let arr = JSON.parse(getDecryptString(res.data.data, this.$password()));
        for (const key in arr) {
          this.labelOption.map((el) => {
            if (el.key == key) {
              el.value = arr[key]
            }
          })
        }
      }
    }
  },
  onShow: function () {
  	   this.getData()
  },
  mounted() {
    // this.getData()
  }
};
</script>

<style  scoped>
page {
  min-height: 100vh;
  padding-bottom: 24rpx;
}

.navigation {
  display: flex;
  align-items: center;
  text-align: center;
  padding: 80rpx 26rpx;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navigationIcon {
  width: 32rpx;
  height: 38rpx;
}

.navigationText {
  width: 100%;
  font-size: 38rpx;
  font-weight: 400;
  color: #000;
  line-height: 54rpx;
  letter-spacing: 2rpx;
}

.authenticationdata {
  width: 100%;
  min-height: 100vh;
  background: rgba(245, 245, 245, 1);
  box-sizing: border-box;

}

.authenticationdata .tabbar {
  padding: 24rpx 24rpx;
  display: flex;
  align-items: center;
  background: rgba(214, 48, 49, 1);
}

.authenticationdata .tabbar .arrow {
  font-size: 36rpx;
  color: #fff;
}

.authenticationdata .tabbar .title {
  width: 100%;
  font-size: 24rpx;
  color: #fff;
  text-align: center;
}

.authenticationdata .main {
  width: 100%;
  padding: 32rpx 24rpx 24rpx;
}

.authenticationdata .main .box {
  width: 100%;
  background: #fff;
  border-radius: 16rpx;
}

.authenticationdata .main .box .filed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 40rpx;
  font-size: 32rpx;
  padding: 24rpx;

}

.authenticationdata .main .box .filed>.value {
  width: 340rpx;
  background: rgba(247, 247, 247, 1);
  color: rgba(173, 173, 173);
  font-weight: 400;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 32rpx 24rpx;
  border-radius: 16rpx;
}

.authenticationdata .main .box .filed>.label {
  position: relative;
  color: #000;


}

.authenticationdata .main .box .filed>.label .sub {
  position: absolute;
  right: -50rpx;
  top: 0;
  color: #fff;
  background: red;
  border-radius: 100%;
  height: 25rpx;
  width: 25rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24rpx;
  /* padding: 4rpx 16rpx; */
}


/* 头部额度部分 */
</style>
